package com.wgchao.identityrightsmanagement.infrastructure.convert;

import com.wgchao.identityrightsmanagement.domain.organization.model.DepartmentOffice;
import com.wgchao.identityrightsmanagement.infrastructure.jpa.entity.SysBaseDepartmentOffice;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

/**
 * @ClassName: DepartmentOfficeConvert
 * @author: wgchao
 * @createTime: 2020/6/17 10:28 AM
 * @Description: TODO
 */
@Component
public class DepartmentOfficeConvert {

    public DepartmentOffice convert(SysBaseDepartmentOffice sysBaseDepartmentOffice) {
        DepartmentOffice departmentOffice = new DepartmentOffice(sysBaseDepartmentOffice.getId(), sysBaseDepartmentOffice.getIdentify(),
                sysBaseDepartmentOffice.getDepartmentCode(), sysBaseDepartmentOffice.getOfficeCode(), sysBaseDepartmentOffice.getVersion());
        return departmentOffice;
    }

    public SysBaseDepartmentOffice convert(DepartmentOffice departmentOffice) {
        SysBaseDepartmentOffice sysBaseDepartmentOffice = new SysBaseDepartmentOffice();
        BeanUtils.copyProperties(departmentOffice, sysBaseDepartmentOffice);
        return sysBaseDepartmentOffice;
    }
}
